﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FamilyManager
{
    public partial class MainForm : Form
    {
        private MainForm()
        {
            InitializeComponent();
        }

        private static MainForm mainForm;

        public static MainForm CreateInstance()
        {
            if (mainForm == null)
            {
                mainForm = new MainForm();
            }
            return mainForm;
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            InitStatusLabel();
        }

        private void InitStatusLabel()
        {
            toolStripStatusLabel1.Text = "欢迎你！admin，今天是:" + DateTime.Now.ToLongDateString() + "   当前时间是:" + DateTime.Now.ToLongTimeString();
        }

        private void tsbPayRecordInput_Click(object sender, EventArgs e)
        {
            PayRecordInputForm objPayRecordInputForm = PayRecordInputForm.CreateInstance();
            objPayRecordInputForm.MdiParent = this;
            objPayRecordInputForm.Show();
        }

        private void tsbQueryPayRecords_Click(object sender, EventArgs e)
        {
            PayRecordQueryForm objPayRecordQueryForm = PayRecordQueryForm.CreateInstance();
            objPayRecordQueryForm.MdiParent = this;
            objPayRecordQueryForm.Show();
        }

        private void tsbMonthBudgetInput_Click(object sender, EventArgs e)
        {
            MonthBudgetInputForm objMonthBudgetInputForm = MonthBudgetInputForm.CreateInstance();
            objMonthBudgetInputForm.MdiParent = this;
            objMonthBudgetInputForm.Show();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            InitStatusLabel();
        }

        private void tsbEarningRecordsInput_Click(object sender, EventArgs e)
        {
            EarningRecordsInputForm objEarningRecordsInputForm = EarningRecordsInputForm.CreateInstance();
            objEarningRecordsInputForm.MdiParent = this;
            objEarningRecordsInputForm.Show();
        }

        private void tsbEarningRecordsQuery_Click(object sender, EventArgs e)
        {
            EarningRecordsQueryForm objEarningRecordsQueryForm = EarningRecordsQueryForm.CreateInstance();
            objEarningRecordsQueryForm.MdiParent = this;
            objEarningRecordsQueryForm.Show();
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            MonthBudgetQueryForm objMonthBudgetQueryForm = MonthBudgetQueryForm.CreateInstance();
            objMonthBudgetQueryForm.MdiParent = this;
            objMonthBudgetQueryForm.Show();
        }

        private void tsbExit_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确认退出系统?", "温馨提示", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void 退出系统ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确认退出系统?", "温馨提示", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                Application.Exit();
            }
        }

 

    }
}
